#pragma once

#include "my_vector.h"
#include <string>
#include <iostream>
#include <algorithm>

class big_int
{
   static const int base = 100000000;
   static const int max_length = 10000;
   static const int length_digit = 8;
   int length;
   my_vector value;
public:
   big_int();
   big_int(long long);
   big_int(std::string);

   std::string long_long_to_str(const long long&) const;
   long long str_to_long_long(const std::string&);
   std::string to_str() const;

   void set_length(int);
   int get_length() const;
   void push_back(long long p);
   long long pop_back();

   bool equals0();
   long long compare (const big_int&) const;
   void swap(big_int&);
   big_int trim();

   long long operator [] (int i) const;

   bool operator == (const big_int&) const;
   bool operator != (const big_int& ) const;
   bool operator > (const big_int&) const;
   bool operator < (const big_int&) const;
   bool operator >= (const big_int&) const;
   bool operator <= (const big_int&) const;

   big_int& operator = (const big_int&);

   friend big_int operator - (const big_int&);

   friend big_int abs(const big_int&);

   bool is_positive() const;

   big_int add (const big_int&) const;
   big_int subtract (const big_int&) const;
   big_int multiply (const big_int&) const;
   big_int divide (const big_int&) const;
   big_int remainder (const big_int&) const;

   friend std::istream& operator >> (std::istream&, big_int&);
   friend std::ostream& operator << (std::ostream&, const big_int&);
   big_int operator + (const big_int&) const;
   big_int operator - (const big_int&) const;
   big_int operator * (const big_int&) const;
   big_int operator / (const big_int&) const;
   big_int operator % (const big_int&) const;
   big_int& operator +=(const big_int& b);
   big_int& operator -=(const big_int& b);
   big_int& operator *=(const big_int& b);
   big_int& operator /=(const big_int& b);
   big_int& operator %=(const big_int& b);
};